package ezXpns.storage.queries;

import org.apache.lucene.index.Term;
import org.apache.lucene.search.TermQuery;

import ezXpns.BudgetChange;
import ezXpns.storage.Query;


//@author A0088827L
public class TagQuery implements Query<BudgetChange> {
	public TagQuery(String tag) {
		this.tag = tag;
		this.luceneQuery = new TermQuery(new Term("tags", tag));
	}

	@Override
	public boolean apply(BudgetChange arg) {
		return arg.hasTag(tag);
	}
	
	@Override
	public org.apache.lucene.search.Query asLuceneQuery() {
		return luceneQuery;
	}

	private String tag;
	private org.apache.lucene.search.Query luceneQuery;
}
